<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../libs/mui.min.css" rel="stylesheet" />
		<link href="../../css/main.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/mine-news.css" />
	</head>

	<body>
		<div class="head">
			<img id="back" src="../../images/all-left.png" alt="">
			<p>我的消息</p>
		</div>

		<div class="content">
			<!--<div class="content-fi">
				<div class="content-fi-le active">
					<span class="red-circle"></span>
				</div>
				<div class="content-fi-ri">
					<p class="content-fi-ri-top">中国银行经理<span class="content-fi-ri-date">下午8:00</span></p>
					<p class="content-fi-ri-buttom">金博会8888元口令红包大派送</p>
				</div>
			</div>

			<div class="content-fi">
				<div class="content-fi-le ">
					<span class="red-circle"></span>
				</div>
				<div class="content-fi-ri">
					<p class="content-fi-ri-top">中国银行经理<span class="content-fi-ri-date">下午8:00</span></p>
					<p class="content-fi-ri-buttom">金博会8888元口令红包大派送</p>
				</div>
			</div>-->
		</div>

		<script src="../../js/jquery-3.1.1.min.js"></script>
		<script src="../../libs/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../../js/url.js"></script>
		<script type="text/javascript">
			$('#back').on('tap',function() {
				mui.back()
			})
			$('.content').on('tap','.content-fi',function() {
				$(this).children().eq(0).removeClass('active');
				localStorage.title=$(this).find('.content-fi-ri-top').text();
				localStorage.date=$(this).attr('date');
				localStorage.content=$(this).find('.content-fi-ri-buttom').text();
				localStorage.setItem('mine-news-href-mine-news-message','mine-news-message.html');
				href(localStorage.getItem('mine-news-href-mine-news-message'),'mine-news-message.html');
			})
			$.ajax({
				type: "get",
				url: ur + "rest/messageController/get",
				async: true,
				dataType: 'json',
				headers: {
					'X-Token': localStorage.token
				},
				success: function(data) {
					if(data.meta.code === 'S002') {
						var msg=data.data;
						var item=$('.content-fi').length
						for(var i = msg.length - 1; i >= item; i--) {
							var msgAdd = "<div date="+msg[i].createDate+" class=\"content-fi\" id=\"news-message-"+
							i+"\" >\n\t<div class=\"content-fi-le active\">\n\t\t<span class=\"red-circle\"></span>\n\t</div>\n\t<div class=\"content-fi-ri\">\n\t\t<p class=\"content-fi-ri-top\">" +
								msg[i].title + "</span></p>\n\t\t<p class=\"content-fi-ri-buttom\">" +
								msg[i].text + "</p>\n\t</div>\n</div>";
							$('.content').prepend(msgAdd);
						}
					} else {
						mui.toast(data.meta.massege);
					}
				}
			});
		</script>
	</body>

</html>